package aop03;

import aop02.EmpService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 石小俊
 */
public class Test {

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = (UserService) ac.getBean("userService");
        try {
            userService.login("admin","123");
        } catch (UserNotExistException e) {
        }
        System.out.println("************************************");
        userService.register("admin","123","213","213");
        System.out.println("************************************");
        SomeService someService = (SomeService) ac.getBean("someService");
        someService.doSome();
        System.out.println("************************************");
        someService.doSome("admin");
        System.out.println("************************************");
        someService.doSome("admin",1);
        System.out.println("************************************");
        someService.doOther();
        System.out.println("************************************");
        someService.add(1,2);
        System.out.println("************************************");
        OtherService otherService = (OtherService) ac.getBean("otherService");
        otherService.doSome();
        System.out.println("************************************");
        otherService.doOther();
        System.out.println("************************************");
        EmpService empService = (EmpService) ac.getBean("empService");
        empService.addEmp();
    }

}
